function BasketBall(text){
    console.log(text)

}
BasketBall.prototype.show= function (){
    // 需要有取消的按钮
    console.log('这里有取消的按钮')
}


function VolleyBall(text){
    console.log(text)
}
VolleyBall.prototype.show= function (){
    // 不仅需要取消
    // 还得有确定按钮
    console.log('这里有取消和确定按钮')
}

const popFactory = function (name){
    switch (name){
        case '篮球':return new BasketBall('篮球');
        case '排球':return new VolleyBall('排球');
    }
}

const basketball  = popFactory('篮球')
basketball.show()

const volleyball = popFactory('排球')
volleyball.show()

